package com.bbznb.common;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class MyException {
    @ExceptionHandler(RuntimeException.class)
    public Result handleException(RuntimeException e) {
        String msg = e.getMessage();
        if(msg.contains("token")||msg.contains("JWT"))
            return Result.build(401, msg, null);
        else
            return Result.build(500, msg, null);
    }
}
